package by.gravity.billprinter;

import android.app.Application;
import by.gravity.billprinter.http.HttpClient;
import by.gravity.billprinter.utils.ContextHolder;

import com.bugsense.trace.BugSenseHandler;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

public class PrinterApplication extends Application {

	@Override
	public void onCreate() {

		super.onCreate();
		ContextHolder.setContext(this);

		ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();

		ImageLoader.getInstance().init(configuration);

		BugSenseHandler.initAndStartSession(this, "2ce236c6");

	}

	@Override
	public Object getSystemService(String name) {

		if (name.equals(HttpClient.HTTP_CLIENT)) {
			return HttpClient.getInstance(getApplicationContext());
		}
		return super.getSystemService(name);
	}

}
